Let's create an Event that causes a jump action every time the Space Bar is pressed.

  • Go to and drag Space Bar into your program.
  • Click Run then press the Space Bar repeatedly.

Space Bar starts with the definition of a function called space(). The function already has the .jump() command in it. The last line is an "event handler" which listens for the space bar to be pressed.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)